/**
 * 统计路由
 * @module routes/stats
 */

const express = require('express');
const router = express.Router();
const statsController = require('../controllers/stats.controller');
const authMiddleware = require('../middlewares/auth.middleware');
const validation = require('../middlewares/validation.middleware');

// 所有路由都需要身份验证
router.use(authMiddleware.authenticate);

// 记录工具使用
router.post('/record', validation.validateStatsRecord, statsController.recordUsage);

// 获取用户的使用统计
router.get('/user', statsController.getUserStats);

// === 管理员路由 ===
// 获取系统总体使用统计
router.get('/system', authMiddleware.requireAdmin, statsController.getSystemStats);

// 获取每日活跃用户数统计
router.get('/daily-active-users', authMiddleware.requireAdmin, statsController.getDailyActiveUsers);

module.exports = router; 